﻿<?=$this->load->view('include_header',null)?>
	<div id="top-panel">
		<div id="panel">
			<ul>
				<li class="current"><a href="<?=site_url('archive/idcard/'.$id)?>" class="report"><?=(empty($id))?"录入新":"编辑"?>客户基本信息</a></li>
				
			</ul>
		</div>
	</div>
	<div id="wrapper">
		<div id="content">
			<div id="box">
			<form id="form" method="POST" action="<?=site_url('archive/osnumber_update/'.$cateid)?>">
			<fieldset>
			<legend>组织机构代码证 Certification of Organization Code </legend>
			
			<label>代码<br>Code:</label><input type="text" name="code" value="<?=@$info->code?>" /> <br /> <br>
			<label>机构名称<br>Name of Organization:</label><input type="text" name="org_name" size="50" value="<?=@$info->org_name?>" /> <br /> <br>
			<label>机构类型<br>Type of Organization:</label><input type="text" name="org_type" size="50" value="<?=@$info->org_type?>" /> <br /><br>	
			<label>地址<br>Address:</label><input type="text" name="address" size="50" value="<?=@$info->address?>" /> <br /> <br>
			<label>有效期从<br>Valid From:</label><input type="text" name="validity_from" id="validity_from" value="<?=@$info->validity_from?>" onchange="check_date_rules()"/> <br /> <br>
			<label>有效期至<br>To:</label><input type="text" name="validity_to" id="validity_to" value="<?=@$info->validity_to?>" onchange="check_date_rules()"/> <br /> <br>
			<label>颁发单位<br>Issued by:</label><input type="text" name="issued_by" size="50" value="<?=@$info->issued_by?>" /> <br /><br>
			<label>登记号<br>Registration No:</label><input type="text" name="reg_no" value="<?=@$info->reg_no?>" /> <br /><br>
			
			<label>年检记录<br>Qualified for:</label><input type="text" name="year" value="<?=@$info->year?>" /> 年<br /> <br>
			<label>between </label><input type="text" name="month_from" value="<?=@$info->month_from?>" /> 月<br />
			<label>and</label><input type="text" name="month_to" value="<?=@$info->month_to?>" /> 月<br />
			<label>No:</label><input type="text" name="no" value="<?=@$info->no?>" /> <br />
						
			<input type="hidden" name="id" value="<?=$id?>" />
			<input id="button1" type="submit" value="提交信息 Continue" onclick="return check_date_rules()"/>
			<input id="button2" type="reset" value="重置 Cancel" />
			</fieldset>
			</form>
			</div>

		</div>
		
		<?=$this->load->view('include_sidebar',array('id'=>$id,'forms'=>$forms))?>
	</div>

	<script type="text/javascript">
    function check_date_rules() {
        if(convert_to_date($('#validity_from').val()).getTime() >  new Date().getTime()) {
            $('#validity_from').focus();  
            alert('[有效期从]不能大于[当前日期]！');
            return false;
        }         
        /*if(convert_to_date($('#validity_to').val()).getTime() >  new Date().getTime()) {
            $('#validity_to').focus();   
            alert('[有效期至]不能大于[当前日期]！');
            return false;
        }*/   
        if(convert_to_date($('#validity_from').val()).getTime() > convert_to_date($('#validity_to').val()).getTime()) {
            $('#validity_from').focus(); 
            alert('[有效期从]不能大于[有效期至]！'); 
            return false;
        }                        
        return true; 
    }
    
	$().ready(function() {
	  $("#form").validate({
		rules: {
			code:{
			 required:true
			},
			org_name:{
			 required:true
			},
			org_type:{
			 required:true
			},
			address:{
			 required:true
			},
			issued_by:{
			 required:true
			},
			reg_no:{
			 required:true
			}
		}
	  });
      
                  
        $.datepicker.setDefaults(
            {
            dateFormat: 'dd/mm/yy',
            changeMonth: true,
            changeYear: true,
            showOn: "both",
            buttonImage: "images/calendar.gif",
            buttonImageOnly: true
            }
        );
        
		$( "#validity_from" ).datepicker();
		$( "#validity_to" ).datepicker();
	});
	</script>
	
<?=$this->load->view('include_footer',null)?>
